nordic: use portable IRQ pending API in drivers/socs - #117388
Conversation
This test turns on ARM_CUSTOM_INTERRUPT_CONTROLLER on every Cortex-M platform, which routes the architecture IRQ operations to z_soc_irq_*() hooks that the test implements on top of the NVIC. It provides the enable, disable, is_enabled, priority, EOI and get_active hooks but not the pending-state ones, and since ARCH_HAS_IRQ_PENDING_OPS is only selected for a plain NVIC, k_irq_*_pending() disappears in this configuration. Drivers that are always part of the image -- system timers and console UARTs -- and that use k_irq_clear_pending() therefore fail to build here, for example mchp_xec_rtos_timer.c on mec15xxevb_assy6853: error: implicit declaration of function 'k_irq_clear_pending' Select ARCH_HAS_IRQ_PENDING_OPS from the test's Kconfig and add NVIC backed z_soc_irq_clear_pending(), z_soc_irq_set_pending() and z_soc_irq_is_pending(), the same way the test already wraps the NVIC for the other hooks. This is exactly what an SoC with a custom controller that can report and clear pending state is expected to do. Built with tests/arch/arm/arm_custom_interrupt on mec15xxevb_assy6853/mec1501_hsz, nrf52840dk/nrf52840, da1469x_dk_pro, apollo3_evb, rts5912_evb and mps2/an385 together with the k_irq_* driver conversions. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
| #include <zephyr/irq.h> | ||
|
|
There was a problem hiding this comment.
| #include <zephyr/irq.h> |
There was a problem hiding this comment.
There is a bug on posix_sw_is_pending_IRQ() (pending != pending & not masked)
The naming of the new functions is off.
The native sim irq handler is not limited to 64 interrupts, better to not limit it now.
This would break out of tree boards, but we don't have to.
Why not add ARCH_HAS_IRQ_GET_ACTIVE also (the underlying API was there already)
Circumstantial: The posix arch and native sim are not nordic boards (even if I work today for nordic), so this should be a separate PR.
Instead of iterating here clarifying the issues, I just queued another version without all these in:
right, I actually had another branch preped for posix_arch, but missed pushing it on its own :| topic/irq-pending/arch-posix, added here because I hot some depenendy with nrf_bsim I guess. |
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
d0340d5 to
fbc5566
Compare
edit by @aescolar
Related